using UnityEngine;
using DG.Tweening;

public class DOTweenCamera : MonoBehaviour
{
    private Camera mCamera;

    public GameObject[] mCameras;
    
    void Start()
    {
        mCamera = GetComponent<Camera>();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            mCamera.DOAspect(0.5f, 1);
        }
        else if (Input.GetKeyDown(KeyCode.S))
        {
            mCamera.DOAspect(2f, 1);
        }
        else if (Input.GetKeyDown(KeyCode.D))
        {
            mCamera.DOAspect(1f, 1);
        }
        else if (Input.GetKeyDown(KeyCode.F))
        {
            mCamera.DOColor(Color.blue, 1);
        }
        else if (Input.GetKeyDown(KeyCode.G))
        {
            mCamera.DONearClipPlane(100, 1);
        }
        else if (Input.GetKeyDown(KeyCode.H))
        {
            mCamera.DOFarClipPlane(5, 1);
        }
        else if (Input.GetKeyDown(KeyCode.J))
        {
            mCamera.DOFieldOfView(20, 1);
        }
        else if (Input.GetKeyDown(KeyCode.K))
        {
            mCamera.DOOrthoSize(1.5f, 1);
        }
        else if (Input.GetKeyDown(KeyCode.Z))
        {
            mCamera.DOPixelRect(new Rect(480, 300, 480, 300), 1);
        }
        else if (Input.GetKeyDown(KeyCode.X))
        {
            mCamera.DORect(new Rect(0.5f, 0.5f, 0.5f, 0.5f), 1).OnComplete(() => { 
                foreach (var camera in mCameras)
                {
                    camera.SetActive(true);
                }; });
        }
        else if (Input.GetKeyDown(KeyCode.C))
        {
            mCamera.DORect(new Rect(0.5f, 0.5f, 0.5f, 0.5f), 1);
        }
        else if (Input.GetKeyDown(KeyCode.V))
        {
            mCamera.DOShakePosition(2, 2, 2, 2);
        }
        else if (Input.GetKeyDown(KeyCode.B))
        {
            mCamera.DOShakeRotation(2, 2, 2, 2);
        }
    }
}
